using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableGuideDao:DaoBase<TableGuide>
    {
        public override void AddPrimaryIndex(TableGuide model)
        {
            cachePrimary[model.guideId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableGuide.txt";
        }

        protected override TableGuide ParseRowData(string[] rowData)
        {
            TableGuide data = new TableGuide();
			data.guideId = rowData [0];

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.order = 0;
            }
            else
            {
                data.order = int.Parse(rowData[1]);
            }
			data.endGuide = rowData [2];
			data.endTag = rowData [3];
			data.loginGuide = rowData [4];
			data.loginTag = rowData [5];
			data.loginTag2 = rowData [6];

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.levelTrigger = 0;
            }
            else
            {
                data.levelTrigger = int.Parse(rowData[7]);
            }
			data.levelTag = rowData [8];
			data.levelTag2 = rowData [9];
			data.questTrigger = rowData [10];
			data.questTag = rowData [11];

            return data;
        }


        public override void AddOneIndex(TableGuide model)
        {
            if (!cacheOneIndex.ContainsKey(model.order.ToString()))
            {
                cacheOneIndex[model.order.ToString()] = new List<TableGuide>();
            }
            cacheOneIndex[model.order.ToString()].Add(model);
        }
    

    }

}
